<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Vue 模板</title>
  <script src="https://cdn.bootcss.com/vue/2.6.11/vue.min.js"></script>
  <style>
    .box {
      border: 1px solid red;
      margin-bottom: 50px;
      padding-bottom: 20px;
      padding-left: 10px;
    }
    .tip {
      color: red;
    }
  </style>
</head>
<body>
  <!-- 主控区域 -->
  <div id="app">
    <div class="box">
      <h3>事件修饰符</h3>
      <p>
        <div @click="bclick">
          <div @click.stop="aclick">div 数据</div>
        </div>
      </p>
    </div>

    <div class="box">
      <h3>按键修饰符</h3>
      <p>
        <input type="text" @keyup.enter="onEnter">
        <br>
        <input type="text" @keyup.up="onUp">
      </p>
    </div>
  </div>
  
  <script>
    var vue = new Vue({
      el: "#app",
      data: {
        msg: "Hello, World"
      },
      methods: {
        aclick: function () {
          console.log('aclick')
        },
        bclick: function () {
          console.log('bclick')
        },
        onEnter: function () {
          console.log('敲回车了')
        },
        onUp: function () {
          console.log("up 键")
        }
      }
    })
  </script>
</body>
</html>